<h1>slurp</h1>

<ul>
<li> <a href="#1">Synopsis</a>
<li> <a href="#2">Code</a>
<ul>
<li> <a href="#3">Uses</a>
<li> <a href="#4">Main</a>
</ul>
<li> <a href="#5">Author</a>
</ul>

<a name="1"></a><h2>Synopsis</h2>
<p>
Grab the output of a shell <em>command</em> into an <em>array</em>, divided by a
<em>seperator</em> (defaults to newline).
</p>
<p>
For very big files, <em>slurp</em> is <em>not</em> recommended. When dealing with
very big files, it is  better to read each line one at a time.
</p>
<a name="2"></a><h2>Code</h2>

<a name="3"></a><h3>Uses</h3>
<p>
<a href="?deShell">deShell</a> 
</p>
<a name="4"></a><h3>Main</h3>
<pre>
 function slurp(com,all, sep) { 
     return split(slurp2String(com),
		  all, 
		  (sep ? sep : "\n")) 
 }
 function slurp2String(com,    txt,filename,fnr,nf,nr,rs,fs ) {
     filename=FILENAME;fnr=FNR;nf=NF;nr=NR;rs=RS;fs=FS;
     RS="\r\r\n"; FS="\r\r\n"; # change globals 
     com = deShell(com)        # make 'com0' safe
     com | getline txt ;       # everything is in 'txt'
     close(com);               # close pipe
     FILENAME=filename;FNR=fnr;NF=nf;NR=nr;RS=rs;FS=fs;
     return txt                # the end
 }
</pre>
<a name="5"></a><h2>Author</h2>
<p>
Tim Menzies
